#include<bits/stdc++.h>
using namespace std;
long long int num[100010];
int ans=0;
set<int>a;
vector<int>b;
int x;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    cin>>n;
    for(int i=0;i<n;i++){

        cin>>x;
        b.push_back(x);
        a.insert(x);
        num[x]++;
    }
    sort(b.begin(),b.end());
    //for(int i=0;i<n;i++)cout<<b[i]<<endl;
    vector<int>::iterator p,q,k;
    set<int>::iterator now=a.begin();
    set<int>::iterator now1=a.begin();
    now1++;
    int cnt=0;
    while(now1!=a.end()){
        p=upper_bound(b.begin(),b.end(),*now);
        //cout<<b.end()-p;
        k=upper_bound(b.begin(),b.end(),*now1);
        q=p-1;
        ans+=num[*q]-(k-p);
        ans=max(ans,0);
        //cout<<ans<<" ";
        //cout<<ans<<" "<<cnt<<" ";
        now++;
        now1++;
    }
    ans+=num[*now];
    cout<<ans;
    return 0;
}
